﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WarringControl : MonoBehaviour
{
    public bool isWarring = false;
    public Transform[] particleArr;
    public Transform lightWarring;

    private bool active = false;
    // Start is called before the first frame update

    private void Awake()
    {
        lightWarring.gameObject.SetActive(false);
        for(int i=0;i<particleArr.Length;i++)
        {
            particleArr[i].gameObject.SetActive(false);
        }
    }

    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(isWarring)
        {
            if(!active)
            {
                for(int i=0;i<particleArr.Length;i++)
                {
                    particleArr[i].gameObject.SetActive(true);
                }
                lightWarring.gameObject.SetActive(true);
                active = true;
            }
        }
        else
        {
            if (active)
            {
                for (int i = 0; i < particleArr.Length; i++)
                {
                    particleArr[i].gameObject.SetActive(false);
                }
                lightWarring.gameObject.SetActive(false);
                active = false;
            }
        }
        lightWarring.Rotate(Vector3.up * 360f * Time.deltaTime);
    }
}
